<style lang="text/css">
.orderPad {

}
.fieldHeading {
	font-weight:bold;
	vertical-align:top;
	text-align:left;
}
.fieldValue {
	vertical-align:top;
	line-height: 1.6em;
}
</style>

<table class="full continuous">
		<thead>
		<tr>
			<th>CUSTOMER DETAILS #<%= @customer.id %> - <%= @customer.name %></th>
		</tr>
		</thead>
</table>
<table class="full continuous">
		<tr>
			<th class="sub" colspan="4">General Details</th>
		</tr>
		<tr>
			<td class="fieldValue" width="25%">
				<strong>Company Name</strong><br />
				<%= @customer.name %>
			</td>
			<td class="fieldValue" width="25%">
				<strong>Alternate Name</strong><br />
				<%= @customer.alternate_name %>
			</td>
			<td class="fieldValue" width="25%">
				<strong>Country</strong><br />
				 <img src="/flag_icons/<%= @customer.country.iso_code %>.gif"> <%= @customer.country.name %>
			</td>

			<td class="fieldValue" width="25%">
				<strong>Status</strong><br />
				<strong style="color:green"><%= @customer.status.name %></strong>
			</td>
		</tr>
		<tr>
			<td class="fieldValue">
				<strong>Phone</strong><br />
				<%= @customer.phone %>
			</td>
			<td class="fieldValue">
				<strong>Fax</strong><br />
				<%= @customer.fax %>
			</td>
			<td class="fieldValue">
				<strong>Email</strong><br />
				<%= @customer.email %>
			</td>
			<td class="fieldValue">
				<strong>Website</strong><br />
				<%= @customer.website_url %>
			</td>
		</tr>
	</table>
	<table class="full continuous">
			<tr>
				<th class="sub" colspan="3">Pricing Details</th>
			</tr>
		<tr>
			<td class="fieldValue">
				<strong>Price Type</strong><br />
				<%= @customer.price_type.title %>
			</td>
			<td class="fieldValue">
				<strong>Payment Terms</strong><br />
				<%= @customer.payment_term.terms_text %>
			</td>
			<td class="fieldValue">
				<strong>Agent(s)</strong><br />
				<%= @customer.agents.collect {|a| "<a href='/customers/#{a.id}'>#{a.name}</a>"}.join(', ') %>
			</td>
		</tr>
	
</table>
<table class="full continuous">
		<tr>
			<th class="sub">Notes</th>
		</tr>
		<tr>
			<td class="fieldValue" width="100%">
				<%= @customer.notes %>
			</td>
		</tr>
	
</table>
<table class="full continuous">
		<tr>
			<th class="sub"><a href=""><img src="/icons/table_add.png" align="right"></a>Addresses 
			<div id="newAddress"><%= link_to_remote '[Add New]', :url =>  customer_new_address_url(@customer.id), :method => 'GET' %></div></th>
		</tr>
		<tr>
			<td class="fieldValue" width="100%" id="addressBox">
				<% @customer.addresses.each do |a| %>
				  <div id="ab<%= a.id %>"class="addressBlock" style="height:300px;width:30%;border:1px solid #ccc;float:left;margin-right:2px;padding:5px">
					<a href="#"><img src="/icons/table_delete.png" align="right"></a><a href="<%= customer_address_url(@customer.id, a.id) %>"><img src="/icons/table_edit.png" align="right"></a><strong>Address: </strong><br />
					<%= a.address %><br />
					<strong>City:</strong><br />
					<%= a.city %><br />
					<strong>Province / Postcode:</strong><br />
					<%= a.postcode %><br />
					<strong>Country:</strong><br />
					<%= a.country.name %><br />
					<% if a.is_default_billing? %>
						<strong style="color:green">Default billing address</strong><br />
					<% end %>
					<% if a.is_default_shipping? %>
						<strong style="color:green">Default shipping address</strong><br />
					<% end %>

					<%= link_to_remote '[Edit via XHR]', :url =>  customer_edit_address_url(@customer.id, a.id), :method => 'GET' %>
		
					
					
				  </div>
				
				<% end %>
			</td>
		</tr>
	
</table>
<table class="full continuous">
		<tr>
			<th class="sub">Users</th>
		</tr>
		<tr>
			<td class="fieldValue" width="50%">
				<%= debug @customer.users %>
			</td>
		</tr>
	
</table>
